package consumption;

import houseHold.GHObject;
import houseHold.ObjectType;
import houseHold.electricObjects.ElectricObjectType;
import houseHold.gasObjects.GasObjectType;
import houseHold.waterObjects.WaterObjectType;

public enum ConsumptionType {
	CONSUMPTION, ELECTRICITY, GAS, WATER;
	public static ObjectType getGenericType(ConsumptionType c) {
		switch (c) {
		case GAS:
			return GasObjectType.GAS_OBJECT;
		case WATER:
			return WaterObjectType.WATER_OBJECT;
		case ELECTRICITY:
			return ElectricObjectType.ELECTRIC_OBJECT;
		default:
			return GHObject.OBJECT;
		}
	}

	public static ConsumptionType match(String value) {

		for (ConsumptionType c : ConsumptionType.values()) {
			if (c.toString().equalsIgnoreCase(value))
				return c;
		}
		return null;
	}

	@Override
	public String toString() {
		switch (this) {
		case GAS:
			return "gas";
		case WATER:
			return "water";
		case ELECTRICITY:
			return "electricity";
		default:
			return "consumption";
		}
	}
}
